package com.itheima.dao.impl;

import com.itheima.dao.BookDao;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author: dh
 * @date: 2023-10-30 14:59
 * 创建一个BookDaoService的类，并实现BookDao接口，重写其中的save方法
 */
@Repository
@Scope("prototype")
public class BookDaoImpl implements BookDao {

    @Override
    public void save() {

        System.out.println("book dao save ...");
    }

    //在构造方法之后执行，替换 init-method
    @PostConstruct
    public void init() {

        System.out.println("init ...");
    }

    //在销毁方法之前执行,替换 destroy-method
    @PreDestroy
    public void destroy() {

        System.out.println("destroy ...");
    }
}
